<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>申报项目类型</title>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript">
var submitFormName = "declareTypeForm";
var closeFlag = false;
var flag = null;
function submitForm(){
		var isPass=$(submitFormName).fireEvent("onSubmit");
		if(isPass){
			var url = null;
			if(flag == "add")
			   url = "${ctx}/system_occupationConfigAction.do?method=addDeclareType";
			else
			   url="${ctx}/system_occupationConfigAction.do?method=editDeclareType";
			var parameters = $(submitFormName).serialize();
			sendAjaxRequest(url,parameters,closeFrm);
		}
	}
function closeFrm(response){
    ajaxSubmitException(response.responseText);
    if("true" == response.responseText){
	    var obj=findFrame('main');
		obj.reloadDeclareTypeList();
		if(!closeFlag){
	        windowClose();
		}
		else {
	        location.reload();
		}
	}
}
function setCloseFlag(flag){
	closeFlag = flag;
}
</script>
</head>

<body  onload="init('${flag}')">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"><span class="window_head_intext" id="window_title"></span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
        <form name="declareTypeForm" action="" method="post" class="required-validate">
        <input type="hidden" id="keyword" name="keyword" value="${declareType.keyword }">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
            <tr>
              <td class="aux_intable_td1">申报项目类型：</td>

              <c:choose>
              	<c:when test="${flag eq 'add' }">
              		<td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
	                  <tr>
	                    <td><input name="perfectItemTypeName" type="text" class="required validate-ajax validate-char" relativeId="keyword" value="${declareType.perfectItemTypeName }"  size="16" maxlength="50"></td>
	                  </tr>
	              </table></td>
              	</c:when>
              	<c:when test="${flag eq 'update' }">
              		<td class="aux_intable_td2"><input  name="perfectItemTypeName" type="text"   value="${declareType.perfectItemTypeName }"  size="16" maxlength="50" readonly="readonly"></td>
              	</c:when>
              </c:choose>


            </tr>
            <tr>
              <td valign="top" class="aux_intable_td1">类型说明：</td>
              <td class="aux_intable_td2">
                <textarea name="description" cols="26" rows="3" class="max-length-100">${declareType.description }</textarea>
              </td>
            </tr>
			 <tr>
               <td class="aux_intable_td1">序 号：</td>
			   <td class="aux_intable_td2"><input name="sequence" type="text" class=" int-range-0-999" value="${declareType.sequence }" size="16"></td>
		      </tr>
        </table>
        </form>
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table id="submitAgain" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="setCloseFlag(true);submitForm();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_saveandnewfile.gif" alt="" width="14" height="14" border="0" align="absbottom"> 保存并新增</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td> <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="setCloseFlag(false);submitForm();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom"> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onblur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom"> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
<script type="text/javascript">
function init(editFlag){
	if(editFlag == 'add'){
		$('window_title').innerText =  "新增申报类型项目";
		$('submitAgain').style.display="";
		flag = "add";
	}else if(editFlag == 'update'){//update
		$('window_title').innerText = "修改新增申报类型项目";
		$('submitAgain').style.display="none";
		flag = "update";
	}
	$('perfectItemTypeName').validateUrl = "${ctx}/system_occupationConfigAction.do?method=checkUniqueDeclareName";
	sourceValue=$('declareTypeForm').serialize();
}
</script>
</body>
</html>